#include "test.h"

void cp_file (const char *argc ,const char *argv,const char *argx)
{

    //文件2清空写文件1
    FILE *fp_argc =fopen(argc,"w+");
    FILE *fp_argv = fopen(argv,"r");
    char ch =0;
    for (int i = 0; EOF !=(ch=fgetc(fp_argv)); i++)
    {
        fputc(ch, fp_argc);
    }
    fclose(fp_argc);
    fclose(fp_argv);

    //文件3追加写文件1
    fp_argc =fopen(argc,"a");
    FILE *fp_argx = fopen(argx,"r");
    ch = 0;
    for (int i = 0; EOF !=(ch=fgetc(fp_argx)); i++)
    {
        fputc(ch, fp_argc);
    }
    fclose(fp_argc);
    fclose(fp_argx);
}
//文件结束符是EOF

int main (int argc, char const * argv[])
{
    if (4<=argc)
    {
        cp_file(argv[1], argv[2],argv[3]);
        
    }
    else
    printf("请按%s格式输入\n" ,argv[0]);
    return 0;
}